.class Lcom/hyphenate/chat/EMKuaiyaLocation$1;
.super Ljava/util/TimerTask;


# instance fields
.field final synthetic this$0:Lcom/hyphenate/chat/EMKuaiyaLocation;

.field final synthetic val$currentUser:Ljava/lang/String;


# direct methods
.method constructor <init>(Lcom/hyphenate/chat/EMKuaiyaLocation;Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/hyphenate/chat/EMKuaiyaLocation$1;->this$0:Lcom/hyphenate/chat/EMKuaiyaLocation;

    iput-object p2, p0, Lcom/hyphenate/chat/EMKuaiyaLocation$1;->val$currentUser:Ljava/lang/String;

    invoke-direct {p0}, Ljava/util/TimerTask;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 6

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->isConnected()Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->getCurrentUser()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/hyphenate/chat/EMKuaiyaLocation$1;->val$currentUser:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    new-instance v0, Lcom/amap/api/discover/Discover;

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v1

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/amap/api/discover/Discover;-><init>(Landroid/content/Context;)V

    :try_start_0
    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v1

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->getEncryptProvider()Lcom/hyphenate/chat/EncryptProvider;

    move-result-object v1

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->getChatConfigPrivate()Lcom/hyphenate/chat/a/b;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/a/b;->C()Ljava/lang/String;

    move-result-object v2

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v3

    invoke-virtual {v3}, Lcom/hyphenate/chat/EMClient;->getChatConfigPrivate()Lcom/hyphenate/chat/a/b;

    move-result-object v3

    invoke-virtual {v3}, Lcom/hyphenate/chat/a/b;->D()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2}, Ljava/lang/String;->isEmpty()Z

    move-result v4

    if-nez v4, :cond_0

    invoke-static {v2}, Lcom/hyphenate/util/CryptoUtils;->fromHexString(Ljava/lang/String;)[B

    move-result-object v2

    const-string/jumbo v4, ""

    invoke-interface {v1, v2, v4}, Lcom/hyphenate/chat/EncryptProvider;->decrypt([BLjava/lang/String;)[B

    move-result-object v2

    new-instance v4, Ljava/lang/String;

    invoke-direct {v4, v2}, Ljava/lang/String;-><init>([B)V

    invoke-virtual {v0, v4}, Lcom/amap/api/discover/Discover;->setApiKey(Ljava/lang/String;)V

    new-instance v2, Lcom/hyphenate/chat/EMKuaiyaLocation$1DiscoverResult;

    iget-object v4, p0, Lcom/hyphenate/chat/EMKuaiyaLocation$1;->this$0:Lcom/hyphenate/chat/EMKuaiyaLocation;

    iget-object v5, p0, Lcom/hyphenate/chat/EMKuaiyaLocation$1;->val$currentUser:Ljava/lang/String;

    invoke-direct {v2, v4, v5}, Lcom/hyphenate/chat/EMKuaiyaLocation$1DiscoverResult;-><init>(Lcom/hyphenate/chat/EMKuaiyaLocation;Ljava/lang/String;)V

    invoke-virtual {v0, v2}, Lcom/amap/api/discover/Discover;->setDiscoverListener(Lcom/amap/api/discover/Discover$AMapDiscoverListener;)V

    invoke-virtual {v0}, Lcom/amap/api/discover/Discover;->getDiscover()V

    :cond_0
    invoke-virtual {v3}, Ljava/lang/String;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_1

    invoke-static {v3}, Lcom/hyphenate/util/CryptoUtils;->fromHexString(Ljava/lang/String;)[B

    move-result-object v0

    const-string/jumbo v2, ""

    invoke-interface {v1, v0, v2}, Lcom/hyphenate/chat/EncryptProvider;->decrypt([BLjava/lang/String;)[B

    move-result-object v0

    new-instance v1, Ljava/lang/String;

    invoke-direct {v1, v0}, Ljava/lang/String;-><init>([B)V

    new-instance v0, Lcom/amap/api/netlocation/AMapNetworkLocationClient;

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v0, v2}, Lcom/amap/api/netlocation/AMapNetworkLocationClient;-><init>(Landroid/content/Context;)V

    invoke-virtual {v0, v1}, Lcom/amap/api/netlocation/AMapNetworkLocationClient;->setApiKey(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/amap/api/netlocation/AMapNetworkLocationClient;->getNetworkLocation()Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "EMKuaiyaLocation"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v3, "network location result:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_1
    :goto_0
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method
